package common.util;

import app.entity.UserSession;
import app.utils.Common;

import javax.servlet.http.HttpSession;

/**
 * 获取登录用户的regionId工具类
 *
 * @author 杨健
 * @since 2019/7/8 13:40
 */
public final class RegionUtil {

    private RegionUtil() {}

    /**
     * 返回用户的regionId
     *
     * @param session session
     * @return 用户的regionId
     */
    public static Integer userRegion(HttpSession session) {
        UserSession user = (UserSession) session.getAttribute(Common.sessionUser);
        return user.getRegionId();
    }
}
